<%@ page language="java" import="java.util.*, java.text.*,com.zjut.zs.util.tools.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*,
com.zjut.zs.school.manager.*, com.zjut.zs.school.dao.*,com.zjut.zs.user.manager.*, com.zjut.zs.user.dao.*,com.zjut.zs.cj.manager.*,
com.zjut.an.config.manager.*, com.zjut.an.config.dao.*, com.zjut.zs.cj.dao.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">  
<meta name="renderer" content="webkit">  
<title></title>
<script type="text/javascript">
var browser=navigator.appName
var b_version=navigator.appVersion
var version=b_version.split(";");
var trim_Version=version[1].replace(/[ ]/g,"");
if(trim_Version=="MSIE9.0"||trim_Version=="MSIE8.0"||trim_Version=="MSIE7.0"||trim_Version=="MSIE6.0")
{
    var returnVal = window.confirm("您的浏览器版本过低或者开启了兼容模式，无法使用本系统，点击确定跳转到帮助页面查阅登录方法", "标题");
    if(returnVal) {
    	window.location.href = "../admin/soft.html";
	}else{
		window.location.href = "../admin/soft.html";
	}
}
</script>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../plugins/assets/plugins/jquery-3.5.1.min.js"></script>
</head>
<style type="text/css">
<!--
a {
	color: #00007f;
	text-decoration: underline;
}
-->
</style>

<body>



	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
    <li><a href="#">登录</a></li>
    </ul>
    </div>
    
<%
AnConfigManager anconfig = (AnConfigManager) SpringContextUtil.getBean("AnConfigManager");
ZsSchoolManager zsManager = (ZsSchoolManager) SpringContextUtil.getBean("ZsSchoolManager");
ZsSchool school = new ZsSchool();
school = (ZsSchool)zsManager.getDataByInstance(1,1,null,null,school).getObjects().get(0);

//生成随机数x，传递给生成验证码的servlet:AuthenCodeImage,以防止出现外网访问验证码不变的情况
Random random=new Random();
double x=random.nextDouble();
%>
<%if(Status.ON.getStatus().equals(school.getScLoginActive())){ //如果仍然可以登录%>
    <form id="form1" action="" method="post" onsubmit="return adminlogin();">  
	    <div class="formbody">    
	    <div class="formtitle"><span>账号登录</span></div>    
	    <ul class="forminfo">
	    <li><label>考生身份证号<b>*</b></label><input id="usIdcard" name="usIdcard" type="text" class="dfinput" placeholder="身份证号" required data-rule-idCard="true" data-msg-required="不能为空" data-msg-idCard="请输入身份证号"/><i></i></li>
	    <li><label>密码<b>*</b></label><input id="usPassword" name="usPassword" type="password" class="dfinput" placeholder="密码" required minlength="6" maxlength="20" autocomplete="off"/>
	    <i>
	    <img src="images/eye.png" style="width:20px;" id="img">
        <script type="text/javascript">
            var pwd = document.getElementById('usPassword');
            var img = document.getElementById('img');
            var flag = 0;
            img.onclick = function(){
                if(flag == 0){
                    pwd.type = 'text'
                    img.src = 'images/eye-close.png'
                    flag = 1
                }else{
                    pwd.type = 'password'
                    img.src = 'images/eye.png'
                    flag = 0;
                }
            }
        </script>
	    <a href="#" onclick="alert('默认初始密码为本人语文学考等级(大写)数学学考等级(小写)外语学考等级(小写)#身份证后6位。如:Abc#123456  成功登录后请即刻修改登录密码！');">密码说明</a></i></li>
	    <li><label>验证码<b>*</b></label>
	    	<input type="text" id="rand" name="rand" class="sfinput"/>
	    	<i><img style="cursor:pointer;width:60px;height:26px;" alt="" onclick="changeValidateCode()" ver_colorofnoisepoint="#888888"   id="JD_Verification1" src="../getValidateImage.action?x=<%=x %>">
	    	<a href="#" onclick="changeValidateCode()">看不清，换一个</a>
	    	</i>
	    </li>
	    <li><label>&nbsp;</label><button type="submit" class="btn btn-primary btn-sm">登录 </button>　</li>
	    
	    <li id="message"></li>
	    <li><a href="../admin/soft.html" target='_blank'>无法登录，请点击帮助页面，</a>  忘记密码使用<a href="getpassword1.jsp">【找回密码】</a>
	    <a class="signup_link" href="http://jingyan.baidu.com/article/22a299b539f4b19e18376a5b.html" target='_blank'>360等浏览器请使用极速模式访问本系统</a>
	    </li>
	    </ul>    
	    </div>
    </form>
    <div style="margin:20px;"><%out.print(anconfig.getSingleConfigInfoByName("考生登录需知")); %></div> 
<%}else{ %>
   <div style="margin:20px;">暂停登录！ <%out.print(anconfig.getSingleConfigInfoByName("暂停登录需知")); %></div> 
<%} %>
 
<script src="../plugins/assets/plugins/jquery-3.5.1.min.js" type="text/javascript"></script>  
<script src="../plugins/assets/plugins/jquery-validation/dist/jquery.validate.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-validation/dist/jquery.metadata.js" type="text/javascript"></script>
<script src="js/formvalidate.js" type="text/javascript"></script>
<script src="../admin/js/publicManager.js" type="text/javascript" charset="utf-8"></script> 


    	
<script type="text/javascript">  		
    $.ajaxSetup({ cache: false }); 
     	
function adminlogin() {
	
		if ($("#usIdcard").val() == "") {
			$("#message").html("登录账号必须填写！");
		} else if ($("#usPassword").val() == "") {
			$("#message").html("登录密码必须填写！");
		} else if ($("#rand").val() == "") {
			$("#message").html("验证码必须填写！");
		} else {
			var jsonString = JSON.stringify(serializeToJSONSimply('#form1'));
			//console.info(jsonString);
			$.ajax({
		    	cache: false,
		    	type: "POST",
		        url:'../zsUserLogin2.action?randnum='+Math.floor(Math.random()*1000000),
		        data:{rowstr:jsonString},// 你的formid
		        async: false,
		        error: function(request) {
		        	alert("网络错误，无法连接到服务器。");
		        },
		        success: function(data) {
		        	////console.log(data);
		        	if(data.message=="success"){
		            	//alert("登录成功");
		            	window.top.location.reload(true);
		            	//window.top.location = './main.jsp'; ///当用ajax访问 时候成功的时候就自动的跳转过去
		        	} else if(data.message=="randfailed"){
		            	$("#message").html("登录失败，验证码错误！");
		        		alert("登录失败，验证码错误！");
		        		changeValidateCode();
		        	} else if(data.message=="timefailed"){
		            	$("#message").html("密码错误超过5次，请于60秒稍后再试！");
		        		alert("密码错误超过5次，请于60秒稍后再试！");
		        		changeValidateCode();
		        	} else {
		        		$("#message").html("登录失败，用户名或密码错误！");
		        		alert("登录失败，用户名或密码错误！");
		        		changeValidateCode();
		        	}
		        }
		    });
		}
		return false;
	}


function changeValidateCode() {    
        //这和浏览器的缓存机制有关系，也可以把页面设置为不缓存，这样就不用这个参数了。"nocache="+new Date().getTime()   
        document.getElementById("JD_Verification1").src=document.getElementById("JD_Verification1").src + "?nocache="+new Date().getTime();    
               
 }   
	</script>
</body>

</html>
